<template>
    <view style="height: 100%">
        <!-- components/probationByPopup.wxml -->

        <!-- <van-popup
            :show="promoterShow"
            @close="promoterClose"
            custom-style="border-radius: 10rpx;width:580rpx;height: 650rpx;background-color:rgba(0, 0, 0,0);z-index: 700;"
            :close-on-click-overlay="false"
        > -->
            <u-popup
                :show="promoterShow"
                @close="promoterClose"
                custom-style="border-radius: 10rpx;width:580rpx;height: 650rpx;background-color:rgba(0, 0, 0,0);z-index: 700;"
                :close-on-click-overlay="false"
                mode="center"
            >
                <view style="position: relative; width: 100%; height: 100%">
                    <image
                        @tap="promoterClose"
                        style="width: 44rpx; height: 44rpx; position: absolute; right: 0rpx; top: 0rpx"
                        src="http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/static/delete.png"
                    ></image>
                    <view class="promoterWarp" v-if="spreadAuditTipType == 1">
                        <view class="promoter_img">
                            <image src="http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/static/promoter.png"></image>
                        </view>
                        <view class="promoter_text">恭喜您，已通过审核成为推广员 快去推广赚优惠吧~</view>
                        <view class="promoter_btn" @tap="totg">
                            <text>去推广</text>
                        </view>
                    </view>

                    <view class="promoterWarp" v-if="spreadAuditTipType == 2">
                        <view class="promoter_img">
                            <image src="http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/static/promoterUn.png"></image>
                        </view>
                        <view class="promoter_text">很遗憾，您的推广员申请审核未通过，请重新申请</view>
                        <view class="promoter_btn" @tap="tosh">
                            <text>去申请</text>
                        </view>
                    </view>
                </view>
                
            </u-popup>
            
        <!-- </van-popup> -->
    </view>
</template>

<script lang="ts">
// import zpMixins from '@/uni_modules/zp-mixins/index';
// import vanPopup from './@vant/weapp/popup/index';
// components/probationByPopup.ts
import { spreadAuditTip, spreadAuditTipClose } from '../../api/marketing/popUpApi';
export default{
    components: {
        // vanPopup
    },
    data() {
        return {
            promoterShow: false,
            spreadAuditTipType: ''
        };
    },
    /**
     * 组件的属性列表
     */
    props: {},
    /**
     * 组件的方法列表
     */
    methods: {
        //关闭推广员申请弹窗
        promoterClose() {
            spreadAuditTipClose({}).then((res) => {
                console.log('关闭审核员推广');
            });
            this.setData({
                promoterShow: false
            });
        },
        // 获取推广审核弹窗状态
        spreadAuditTip() {
            if (uni.getStorageSync('memberId')) {
                spreadAuditTip({}).then((res) => {
                    let spreadAuditTipType = null;
                    if (res.data == true) {
                        spreadAuditTipType = 1;
                    } else if (res.data == false) {
                        spreadAuditTipType = 2;
                    }
                    this.setData({
                        spreadAuditTipType,
                        promoterShow: spreadAuditTipType == 1 || spreadAuditTipType == 2
                    });
                    console.log(res, '推广审核res.....');
                });
            }
        },
        // 去推广首页
        totg() {
            uni.navigateTo({
                url: '/marketing_page/pages/promotion/index/index'
            });
        },
        // 去推广审核页
        tosh() {
            uni.navigateTo({
                url: `/marketing_page/pages/promotion/recruit_plan/recruit_plan`
            });
        }
    },
    created: function () {
        if(uni.getStorageSync('memberId')){
            console.log('获取推广员审核弹窗!!!')
            this.spreadAuditTip()
        }
    }
};
</script>
<style lang="less">
@import '../../pages/index/home-popup.less';
</style>
